package org.example.account.controller;

import cn.lingyangwl.framework.core.response.Resp;
import org.example.account.service.AccountService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @author shenguangyang
 */
@RestController
public class AccountController {
    @Resource
    AccountService accountService;

    @PostMapping("/account/decrease")
    public Resp<?> decrease(@RequestParam("userId") Long userId , @RequestParam("money") BigDecimal money) throws InterruptedException {
        accountService.decrease(userId, money);
        return Resp.ok("扣减用户余额成功");
    }
}
